package com.wc.alorithm_luogu.P1271;

import java.util.Scanner;

/**
 * @author congege
 * @create 2023:04:28 10:11
 * @describe https://www.luogu.com.cn/problem/P1271
 * 选举学生会
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] array = new int[n + 1];
        while (m-- > 0) {
            array[sc.nextInt()]++;
        }

        StringBuilder ans = new StringBuilder();
        int index = 0;
        while (array[index] == 0) {
            index++;
        }
        ans.append(index);
        array[index]--;
        for (int i = 1; i < array.length; i++) {
            int right = array[i];
            for (int j = 0; j < right; j++) {
                ans.append(" ");
                ans.append(i);
            }
        }
        System.out.println(ans);
    }
}
